<!-- 师傅评价列表 -->
<template>
    <div style="padding: 12px 16px;">
      <div style="display: flex;align-items: center;padding-left: 12px 10px; margin-bottom: 10px;">
        <el-input v-model="searchText" placeholder="请输入内容" style="max-width: 220px;margin-right: 16px;" />
        <el-button type="primary" icon="el-icon-search" @click="onSearch">搜索</el-button>
      </div>
      <MasterCommentTable :tableList="tableList" @refreshList="onSearch"/>
      <pagination v-show="total>0" :total="total" :page.sync="pageParams.pageIndex" :limit.sync="pageParams.pageSize" @pagination="getCommentList" />
    </div>
  </template>
  
<script>
import MasterCommentTable from './table.vue';
import Pagination from '@/components/Pagination';
import { getPageYzComment } from '@/api/yzComment';

export default {
  components: {
      MasterCommentTable,
      pagination: Pagination
  },
  data() {
    return {
      activeName: 'first',
      name: '我要下单',
      searchText: '',
      pageParams: { pageIndex: 0, pageSize: 10 },
      total: 0,
      tableList: []
    }
  },
  mounted() {
    this.getCommentList();
  },
  methods: {
    async getCommentList() {
      const userInfo = sessionStorage.getItem('userInfo');
      const userId = JSON.parse(userInfo)['id'];
      const { data } = await getPageYzComment({ buserId: userId, ...this.pageParams, queryBean: { searchText: this.searchText } })
      if (data.code === 200) {
        this.tableList = data.data.records || [];
        this.total = data.data.total;
      } else {
        this.$message({
          message: data.msg || '列表获取失败',
          type: 'error',
          showClose: true,
          duration: 3000,
        });
      }
    },
    onSearch() {
      this.getCommentList();
    },
  }
}
</script>

<style>
.deleteBorder .el-tabs__nav-wrap::after{
    height: 0;
  }
.pagination-container {
  float: right;
}
</style>
  